import { defineStore } from 'pinia'
import { removeToken, removeTokenTime, getToken } from '@/utils/auth'
import { ref } from 'vue'
export default defineStore('app', () => {
  const lang = ref<string>(localStorage.getItem('lang') || 'zh-CN')
  const token = ref<string>(getToken() || '')
  const logout = () => {
    removeToken()
    removeTokenTime()
    localStorage.removeItem('userId')
  }
  return {
    lang,
    token,
    logout
  }
})
